<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>API Explorer</title>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}"/>
    <link rel="stylesheet" th:href="@{/admin/css/fangge-style.css}"/>
    <link rel="stylesheet" th:href="@{/admin/css/pear-tree/dtree.css}"/>
    <link rel="stylesheet" th:href="@{/admin/css/doc-common.css}"/>
    <link rel="stylesheet" th:href="@{/admin/css/nav.css}"/>
    <style>
        .dtree-nav-div cite {
            font-family: 'Roboto', sans-serif;
            font-size: 15px;
        }

        .code-block {
            background-color: #283142;
            color: white;
            font-size: 15px;
            font-family: Roboto, serif;
        }

        .layui-table td, .layui-table th {
            color: #0C0C0C;
            font-size: 15px;
        }

        .layui-table th {
            text-align: center;
        }

        #urlSpan:hover {
            cursor: pointer;
        }

        #editDocDescriptionBtn:hover {
            cursor: pointer;
        }

        tr:hover {
            cursor: pointer;
        }

        body {
            background-color: white;
        }

        .line-row-block {
            margin-top: 40px;
        }

        .edit-state {
            color: #FF5722;
            font-weight: bold;
        }

    </style>
</head>
<body>
<input id="projectId" type="hidden" th:value="${projectId}">

<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
    <ul class="layui-tab-title">
        <li class="layui-this">文档</li>
        <li>调试</li>
    </ul>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
            <div class="layui-row">
                <div class="layui-col-md9">
                    <span style="margin-left: 2%"><h2 th:text="${document.name}"></h2></span>
                    <div class="layui-row code-block" style="margin-top: 1%; height: 60px;line-height: 60px; ">
                        <span style="margin-left: 2%">HTTP1.1 GET <span th:text="${document.url}"></span></span>
                        <span id="urlSpan" style="position: absolute;right: 10px;margin-top: -1%"><i
                                class="layui-icon layui-icon-file-b" style="font-size: 25px; color: whitesmoke;"
                                title="复制URL" id="copyURL"></i></span>
                    </div>
                    <div class="layui-row">
                        备注
                        <blockquote class="layui-elem-quote" id="editDocDescriptionBtn">
                            <div class="layui-text	" th:utext="${document.description}"
                                 id="descriptionArea"></div>
                        </blockquote>
                    </div>

                    <div class="layui-row line-row-block"
                         th:if="${document.queryParamDescriptors!=null and !document.queryParamDescriptors.isEmpty()}">


                        <fieldset class="layui-elem-field">
                            <legend>Query Param <span style="cursor: pointer">
                                <i id="editQueryParamTableBtn" class="layui-icon layui-icon-edit"
                                   style="font-size: 19px;"></i></span>
                            </legend>
                            <div class="layui-field-box">
                                <div class="layui-row">
                                    <form action="" class="layui-row">
                                        <table class="layui-table" id="queryParamListTable" lay-size="lg">
                                            <thead>
                                            <tr>
                                                <th>参数</th>
                                                <th>示例值</th>
                                                <th>说明</th>
                                            </tr>
                                            </thead>
                                            <tbody id="queryParamListTableBody">
                                            </tbody>
                                        </table>
                                    </form>
                                </div>
                                <div class="layui-row">
                                    <div class="layui-col-md10"></div>
                                    <div class="layui-col-md2" style="margin-left:85% ">
                                        <div class="layui-inline">
                                            <button type="button" id="saveQueryParamTableBtn" class="layui-btn"
                                                    style="display: none">
                                                保存
                                            </button>
                                        </div>
                                        <div class="layui-inline">
                                            <button type="button" id="cancelQueryParamTableBtn"
                                                    class="layui-btn layui-btn-danger" style="display: none">
                                                取消
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </fieldset>
                    </div>
                    <div class="layui-row line-row-block"
                         th:if="${document.uriVarDescriptors!=null and !document.uriVarDescriptors.isEmpty()}"
                    >
                        <fieldset class="layui-elem-field">
                            <legend>URI Variable <span style="cursor: pointer">
                                <i id="editURIVarTableBtn" class="layui-icon layui-icon-edit"
                                   style="font-size: 19px;"></i></span>
                            </legend>
                            <div class="layui-field-box">
                                <div class="layui-row">
                                    <form action="" class="layui-row">
                                        <table class="layui-table" id="uriFieldListTable" lay-size="lg">
                                            <colgroup>
                                                <col width="220">
                                                <col width="220">
                                                <col width="400">
                                                <col>
                                            </colgroup>
                                            <thead>
                                            <tr>
                                                <th>参数</th>
                                                <th>示例值</th>
                                                <th>说明</th>
                                            </tr>
                                            </thead>
                                            <tbody id="uriFieldListTableBody">
                                            </tbody>
                                        </table>
                                    </form>
                                </div>
                                <div class="layui-row">
                                    <div class="layui-col-md10"></div>
                                    <div class="layui-col-md2" style="margin-left:85% ">
                                        <div class="layui-inline">
                                            <button type="button" id="saveURIVarTableBtn" class="layui-btn"
                                                    style="display: none">
                                                保存
                                            </button>
                                        </div>
                                        <div class="layui-inline">
                                            <button type="button" id="cancelURIVarTableBtn"
                                                    class="layui-btn layui-btn-danger" style="display: none">
                                                取消
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </fieldset>
                    </div>
                    <div class="layui-row line-row-block"
                         th:if="${document.requestHeaderDescriptor!=null and !document.requestHeaderDescriptor.isEmpty()}"
                    >
                        <fieldset class="layui-elem-field">
                            <legend>HTTP Request Header <span style="cursor: pointer">
                                <i id="editRequestHeaderTableBtn" class="layui-icon layui-icon-edit"
                                   style="font-size: 19px;"></i></span>
                            </legend>
                            <div class="layui-field-box">
                                <div class="layui-row">
                                    <form class="layui-form">
                                        <table class="layui-table" id="requestHeaderListTable" lay-size="lg">
                                            <colgroup>
                                                <col width="200">
                                                <col width="250">
                                                <col width="180">
                                                <col>
                                            </colgroup>
                                            <thead>
                                            <tr>
                                                <th>参数</th>
                                                <th>示例值</th>
                                                <th>是否可选</th>
                                                <th>说明</th>
                                            </tr>
                                            </thead>
                                            <tbody id="requestHeaderListTableBody">
                                            </tbody>
                                        </table>
                                    </form>
                                </div>
                                <div class="layui-row">
                                    <div class="layui-col-md10"></div>
                                    <div class="layui-col-md2" style="margin-left:85% ">
                                        <div class="layui-inline">
                                            <button type="button" id="saveRequestHeaderTableBtn" class="layui-btn"
                                                    style="display: none">
                                                保存
                                            </button>
                                        </div>
                                        <div class="layui-inline">
                                            <button type="button" id="cancelRequestHeaderTableBtn"
                                                    onclick="resetRequestHeaderTable()"
                                                    class="layui-btn layui-btn-danger" style="display: none">
                                                取消
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </fieldset>
                    </div>
                    <div class="layui-row line-row-block"
                         th:if="${document.requestBodyDescriptor!=null and !document.requestBodyDescriptor.isEmpty()}"
                    >
                        <fieldset class="layui-elem-field">
                            <legend>HTTP Request Body <span style="cursor: pointer">
                                <i id="editRequestBodyTableBtn" class="layui-icon layui-icon-edit"
                                   style="font-size: 19px;"></i></span>
                            </legend>
                            <div class="layui-field-box">
                                <div class="layui-row">
                                    <form class="layui-form">
                                        <table class="layui-table" id="requestBodyFieldListTable" lay-size="lg">
                                            <colgroup>
                                                <col width="200">
                                                <col width="200">
                                                <col width="200">
                                                <col width="120">
                                                <col>
                                            </colgroup>
                                            <thead>
                                            <tr>
                                                <th>参数</th>
                                                <th>类型</th>
                                                <th>示例值</th>
                                                <th>可选</th>
                                                <th>说明</th>
                                            </tr>
                                            </thead>
                                            <tbody id="requestBodyFieldListTableBody">
                                            </tbody>
                                        </table>
                                    </form>
                                </div>
                                <div class="layui-row">
                                    <div class="layui-col-md10"></div>
                                    <div class="layui-col-md2" style="margin-left:85% ">
                                        <div class="layui-inline">
                                            <button type="button" id="saveRequestBodyTableBtn" class="layui-btn"
                                                    style="display: none">
                                                保存
                                            </button>
                                        </div>
                                        <div class="layui-inline">
                                            <button type="button" id="cancelRequestBodyTableBtn"
                                                    class="layui-btn layui-btn-danger" style="display: none">
                                                取消
                                            </button>
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </fieldset>

                    </div>
                    <div class="layui-row line-row-block"
                         th:if="${document.responseBodyDescriptors!=null and !document.responseBodyDescriptors.isEmpty()}"
                    >

                        <fieldset class="layui-elem-field">
                            <legend>HTTP Response Body <span style="cursor: pointer">
                                <i id="editResponseBodyTableBtn" class="layui-icon layui-icon-edit"
                                   style="font-size: 19px;"></i></span>
                            </legend>
                            <div class="layui-field-box">
                                <form class="layui-form">
                                    <div class="layui-row">
                                        <table class="layui-table" id="responseBodyFieldListTable" lay-size="lg">
                                            <colgroup>
                                                <col width="150">
                                                <col width="120">
                                                <col width="150">
                                                <col width="200">
                                                <col>
                                            </colgroup>
                                            <thead>
                                            <tr>
                                                <th>参数</th>
                                                <th>类型</th>
                                                <th>示例值</th>
                                                <th>说明</th>
                                            </tr>
                                            </thead>
                                            <tbody id="responseBodyFieldListTableBody">
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class="layui-row">
                                        <div class="layui-col-md10"></div>
                                        <div class="layui-col-md2" style="margin-left:85% ">
                                            <div class="layui-inline">
                                                <button type="button" id="saveResponseBodyTableBtn" class="layui-btn"
                                                        style="display: none">
                                                    保存
                                                </button>
                                            </div>
                                            <div class="layui-inline">
                                                <button type="button" id="cancelResponseBodyTableBtn"
                                                        onclick="resetResponseBodyTable()"
                                                        class="layui-btn layui-btn-danger" style="display: none">
                                                    取消
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </fieldset>
                    </div>
                    <div class="layui-row line-row-block"
                         th:if="${document.responseHeaderDescriptors!=null and !document.responseHeaderDescriptors.isEmpty()}"
                         style="display: none">
                        HTTP Response Header

                        <div class="layui-row">
                            <div class="layui-col-md2" style=" margin-top: 10px;">
                                <div class="layui-inline">
                                    <button type="button" id="editResponseHeaderTableBtn" class="layui-btn">
                                        编辑
                                    </button>
                                </div>
                                <div class="layui-inline">
                                    <button type="button" id="saveResponseHeaderTableBtn" class="layui-btn"
                                            style="display: none">
                                        保存
                                    </button>
                                </div>
                                <div class="layui-inline">
                                    <button type="button" id="cancelResponseHeaderTableBtn"
                                            onclick="resetRequestHeaderTable()"
                                            class="layui-btn layui-btn-danger" style="display: none">
                                        取消
                                    </button>
                                </div>
                            </div>
                        </div>
                        <form class="layui-form">
                            <table class="layui-table" id="responseHeaderListTable" lay-size="lg">
                                <colgroup>
                                    <col width="200">
                                    <col width="250">
                                    <col width="180">
                                    <col>
                                </colgroup>
                                <thead>
                                <tr>
                                    <th>参数</th>
                                    <th>示例值</th>
                                    <th>是否可选</th>
                                    <th>说明</th>
                                </tr>
                                </thead>
                                <tbody id="responseHeaderListTableBody">
                                </tbody>
                            </table>
                        </form>
                    </div>
                    <div class="layui-row line-row-block">
                        Code Sample
                        <div class="layui-tab layui-tab-card ">
                            <ul class="layui-tab-title">
                                <li class="layui-this">CURL</li>
                                <li>Java</li>
                                <li>Python</li>
                            </ul>
                            <div class="layui-tab-content" style="height: 500px;">
                                <div class="layui-tab-item layui-show">
                                    <div class="language-html line-numbers-mode">
                                        <pre class="layui-code" lay-title="CURL" lay-skin="notepad"
                                             th:text="${document.curlCodeSample}"></pre>
                                    </div>
                                </div>
                                <div class="layui-tab-item">
                                    <div>
                                        <pre class="layui-code" lay-title="CURL" lay-skin="notepad"
                                             th:text="${document.javaCodeSample}"></pre>
                                    </div>
                                </div>
                                <div class="layui-tab-item">
                                    <div>
                                        <pre class="layui-code" lay-title="CURL" lay-skin="notepad"
                                             th:text="${document.pythonCodeSample}"></pre>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-tab-item">
            <div class="layui-row">
                <iframe id="testApiFrame" th:src="@{'/'+${projectId}+'/document/view/'+${document.id}+'/test'}"
                        style="width: 100%;height: 900px" frameborder="no" border="0" marginwidth="0"
                        marginheight="0"></iframe>
            </div>
        </div>
    </div>
</div>

<div style="display: none" id="copyDocDiv">
    <div class="layui-container">

    </div>
</div>

<script th:src="@{/layui/layui.js}"></script>
<script th:src="@{/admin/js/jquery.js}"></script>
<script th:src="@{/admin/js/util.js}"></script>
<script th:src="@{/layui/lay/extends/tinymce/tinymce.min.js}"></script>
<script th:src="@{/admin/js/api_detail.js}"></script>
<script th:inline="javascript">

    var documentId = [[${document.id}]];
    var doc = [[${document}]];
    var url = [[${document.url}]];
    var projectId = $("#projectId").val();

    var readOnly = parent.readOnly;

    if (readOnly !== null) {
        $('#editRequestBodyTableBtn,#editQueryParamTableBtn,#editURIVarTableBtn,#editResponseBodyTableBtn,#editRequestHeaderTableBtn,#editResponseHeaderTableBtn')
            .css('display', 'none');
    }

    var lay = null;
    var gform = null;

    layui.config({
        base: '/restdoc/layui/lay/extends/'
    }).use(['layer', 'element', 'jquery', 'layedit', 'form', 'code'],
        function () {
            var $ = layui.jquery;
            var layer = layui.layer;
            var element = layui.element;
            var form = layui.form;
            gform = form;
            lay = layer;

            element.on('tab(docDemoTabBrief)', function (data) {
                if (0 === data.index) {
                    $.ajax({
                        url: '/restdoc/document/' + documentId,
                        method: 'GET',
                        success: function (res) {
                            if (res.code === '200') {
                                console.info(res.data);
                                doc = res.data;
                                renderApiTable();
                            } else {
                                console.info(res);
                            }
                        }
                    })
                }
            });

            renderApiTable();

            $("#editDocDescriptionBtn").on('dblclick', function (event) {
                if (readOnly !== null) return;
                layer.open({
                    type: 2,
                    title: "编辑文档备注",
                    area: ['800px', '600px'],
                    content: ['/restdoc/document/' + documentId + '/snippet/view?type=description&field=1', 'no'],
                    btn: ["保存", "取消"],
                    yes: function (index, dom) {
                        var res = window["layui-layer-iframe" + index].getValue();
                        var doc = updateDocumentTable("description", res);
                        if (doc != null) {
                            renderDescription(doc['description'])
                        }
                        layer.close(index)
                    }
                });
            });

            function renderApiTable() {
                renderURITable(doc['uriVarDescriptors']);
                renderRequestHeaderTable(doc['requestHeaderDescriptor']);
                renderRequestBodyTable(doc['requestBodyDescriptor']);
                renderResponseBodyTable(doc['responseBodyDescriptors']);
                renderQueryParamTable(doc['queryParamDescriptors']);
                renderResponseHeaderTable(doc['responseHeaderDescriptors']);
            }
        });

    $("#copyURL").click(function () {
        const input = document.createElement('input');
        document.body.appendChild(input);
        input.setAttribute('value', url);
        input.select();
        if (document.execCommand('copy')) {
            document.execCommand('copy');
            layer.tips('复制成功', '#copyURL', {
                tipsMore: true
            });
        }
        document.body.removeChild(input);
    });

    function renderURITable(uriFields) {
        if (uriFields !== null && uriFields.length > 0) {
            var allLine = "";

            for (let i = 0; i < uriFields.length; i++) {
                var param = "'" + uriFields[i]['field'] + "'";
                var fun = "openEditVarPage(" + param + ")";

                var line = '<td>' + uriFields[i]['field'] + '</td>' +
                    '<td>' + uriFields[i]['value'] + '</td>' +
                    '<td>' + uriFields[i]['description'] + '</td>';

                var start = "<tr  ondblclick=" + fun + " >",
                    end = "</tr>";
                allLine = allLine + start + line + end;
            }
            $("#uriFieldListTableBody").html(allLine);
        }
    }

    function renderQueryParamTable(queryParamFields) {
        if (queryParamFields !== null && queryParamFields.length > 0) {
            var allLine = "";

            for (let i = 0; i < queryParamFields.length; i++) {
                var param = "'" + queryParamFields[i]['field'] + "'";
                var fun = "openEditVarPage(" + param + ")";

                var line = '<td>' + queryParamFields[i]['field'] + '</td>' +
                    '<td> ' + queryParamFields[i]['value'] + ' </td>' +
                    '<td> ' + queryParamFields[i]['description'] + '</td>';

                var start = "<tr >",
                    end = "</tr>";
                allLine = allLine + start + line + end;
            }
            $("#queryParamListTableBody").html(allLine);
        }
    }

    function renderRequestHeaderTable(headerFields) {
        if (headerFields !== null && headerFields.length > 0) {
            var allLine = "";
            for (let i = 0; i < headerFields.length; i++) {

                var param = "'" + headerFields[i]['field'] + "'";
                var fun = "openEditRequestHeaderPage(" + param + ")";

                var line = '<td>' + headerFields[i]['field'] + '</td>' + '<td>' + headerFields[i]['value'] + '</td>' + '<td>' + headerFields[i]['optional'] + '</td>' + '<td>' + headerFields[i]['description'] + '</td>';

                // var start = "<tr ondblclick=" + fun + ">", end = "</tr>";
                var start = "<tr>", end = "</tr>";
                allLine = allLine + start + line + end;
            }
            $("#requestHeaderListTableBody").html(allLine);
        }
    }

    function renderResponseHeaderTable(headerFields) {
        if (headerFields !== null && headerFields.length > 0) {
            var allLine = "";
            for (let i = 0; i < headerFields.length; i++) {

                var param = "'" + headerFields[i]['field'] + "'";
                var fun = "openEditRequestHeaderPage(" + param + ")";
                var line = '<td>' + headerFields[i]['field'] + '</td>' + '<td>' + headerFields[i]['value'] + '</td>' + '<td>' + headerFields[i]['optional'] + '</td>' + '<td>' + headerFields[i]['description'] + '</td>';
                var start = "<tr>", end = "</tr>";
                allLine = allLine + start + line + end;
            }
            $("#responseHeaderListTableBody").html(allLine);
        }
    }

    function renderRequestBodyTable(requestBodyFields) {

        if (requestBodyFields !== null && requestBodyFields.length > 0) {
            var allLine = "";
            for (let i = 0; i < requestBodyFields.length; i++) {

                var param = "'" + requestBodyFields[i]['path'] + "'";
                var fun = "openEditRequestBodyPage(" + param + ")";
                // var start = "<tr ondblclick=" + fun + ">", end = "</tr>";
                var start = "<tr >", end = "</tr>";

                var line = '<td>' + requestBodyFields[i]['path'] + '</td>' + '<td>' + requestBodyFields[i]['type'].toLowerCase() + '</td>' + '<td>' + requestBodyFields[i]['value'] + '</td>' + '<td>' + requestBodyFields[i]['optional'] + '</td>' + '<td>' + requestBodyFields[i]['description'] + '</td>';
                allLine = allLine + start + line + end;
            }
            $("#requestBodyFieldListTableBody").html(allLine)
        }
    }

    function renderResponseBodyTable(responseBodyFields) {
        if (responseBodyFields !== null && responseBodyFields.length > 0) {
            var allLine = "";
            for (let i = 0; i < responseBodyFields.length; i++) {

                var param = "'" + responseBodyFields[i]['path'] + "'";
                var fun = "openEditResponseBodyPage(" + param + ")";
                // var start = "<tr ondblclick=" + fun + ">", end = "</tr>";
                var start = "<tr>", end = "</tr>";

                var line = '<td>' + responseBodyFields[i]['path'] + '</td>' + '<td>' + responseBodyFields[i]['type'].toLowerCase() + '</td>' + '<td>' + responseBodyFields[i]['value'] + '</td>' + '<td>' + responseBodyFields[i]['description'] + '</td>';
                allLine = allLine + start + line + end;
            }
            $("#responseBodyFieldListTableBody").html(allLine);
        }
    }

    function openEditVarPage(field) {
        if (readOnly !== null) return;
        lay.open({
            type: 2,
            title: "编辑URI路径参数",
            area: ['800px', '600px'],
            content: ['/restdoc/document/' + documentId + '/snippet/view?type=uri&field=' + field, 'no'],
            btn: ["保存", "取消"],
            yes: function (index, dom) {
                var res = window["layui-layer-iframe" + index].getValue();
                var doc = updateDocumentTable("uri", res);

                if (doc != null) {
                    renderURITable(doc['uriVarDescriptors'])
                }
                lay.close(index)
            }
        });
    }

    function openEditRequestHeaderPage(field) {
        if (readOnly !== null) return;
        lay.open({
            type: 2,
            title: "编辑请求头参数",
            area: ['800px', '600px'],
            content: ['/restdoc/document/' + documentId + '/snippet/view?type=requestHeader&field=' + field, 'no'],
            btn: ["保存", "取消"],
            yes: function (index, dom) {
                var res = window["layui-layer-iframe" + index].getValue();
                var doc = updateDocumentTable("requestHeader", res);
                if (doc != null) {
                    renderRequestHeaderTable(doc['requestHeaderDescriptor'])
                }
                lay.close(index)
            }
        });
    }

    function openEditRequestBodyPage(field) {
        if (readOnly !== null) return;
        lay.open({
            type: 2,
            title: "编辑请求体参数",
            area: ['800px', '600px'],
            content: ['/restdoc/document/' + documentId + '/snippet/view?type=requestBody&field=' + encodeURIComponent(field), 'no'],
            btn: ["保存", "取消"],
            yes: function (index, dom) {
                var res = window["layui-layer-iframe" + index].getValue();
                var doc = updateDocumentTable("requestBody", res);
                if (doc != null) {
                    renderRequestBodyTable(doc['requestBodyDescriptor'])
                }
                lay.close(index)
            }
        });
    }

    function openEditResponseBodyPage(field) {
        if (readOnly !== null) return;
        lay.open({
            type: 2,
            title: "编辑响应体参数",
            area: ['800px', '600px'],
            content: ['/restdoc/document/' + documentId + '/snippet/view?type=responseBody&field=' + field, 'no'],
            btn: ["保存", "取消"],
            yes: function (index, dom) {
                var res = window["layui-layer-iframe" + index].getValue();
                var doc = updateDocumentTable("responseBody", res);
                if (doc != null) {
                    renderResponseBodyTable(doc['responseBodyDescriptors'])
                }
                lay.close(index)
            }
        });
    }

    function renderDescription(description) {
        $("#descriptionArea").html(description)
    }

    function updateDocumentTable(type, data) {
        var returnValue = null;
        $.ajax({
            method: 'PATCH',
            url: '/restdoc/document/' + documentId + '/snippet/' + type,
            contentType: 'application/json;charset=utf-8',
            dataType: 'json',
            data: JSON.stringify(data),
            async: false,
            success: function (data) {
                if ('200' === data['code']) {
                    returnValue = data['data'];
                    layer.msg("文档修改成功");
                } else {
                    layer.msg(data['message']);
                }
            }
        });
        return returnValue;
    }

</script>
</body>
</html>